package com.projectsquirrel;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TextView;


import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class savedPhoto extends ListActivity {
	
	
	
	LinearLayout mLinearLayout;

	protected void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);

	    // Create a LinearLayout in which to add the ImageView
	    mLinearLayout = new LinearLayout(this);

	    // Instantiate an ImageView and define its properties
	    ImageView i = new ImageView(this);
	    i.setImageResource(R.drawable.takesurvey);
	    i.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions
	    i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

	    // Add the ImageView to the layout and set the layout as the content view
	    mLinearLayout.addView(i);
	    setContentView(mLinearLayout);
	}
	@Override
	public void onResume() {
		super.onResume();
        String[] fileNames = fileList();
        setListAdapter(new ArrayAdapter<String>(this,  android.R.layout.simple_list_item_1, fileNames));      
    }
	@Override
	public void onRestart() {
		super.onRestart();
        String[] fileNames = fileList();
        setListAdapter(new ArrayAdapter<String>(this,  android.R.layout.simple_list_item_1, fileNames));      
    }
	@Override
	public void onPause() {
		super.onPause();
        //final ListView list = (ListView) findViewById(android.R.layout.simple_list_item_1);
        String[] fileNames = fileList();
        setListAdapter(new ArrayAdapter<String>(this,  android.R.layout.simple_list_item_1, fileNames));
    }
	@Override
    protected void onListItemClick(ListView l, View v, int position, long id) 
    {    
		String filename = ((TextView) v).getText().toString();		
		//Intent i = new Intent(savedPhoto.this, displayphoto.class);
		//i.putExtra("FileName", filename);
	//	startActivity(i);   
		
    }
	
}